
const { createProxyMiddleware } = require('http-proxy-middleware');
const target="http://140.143.143.179"
// const target="http://127.0.0.1:8002"
module.exports = function (app) {
    app.use(
        '/hlg',
        createProxyMiddleware({
            target, // 需要跨域处理的请求地址
            changeOrigin: true,
            pathRewrite: { // 请求中去除/api
                "^/hlg": "/hlg"
            },
            secure:false,
            onProxyReq: function onProxyReq(proxyReq, req, res) {
                // 我就打个log康康
                console.log('-->  ', req.method, req.baseUrl, '->', proxyReq.host + proxyReq.path);
            }
        })
    )
    app.use(
        '/app',
        createProxyMiddleware({
            target, // 需要跨域处理的请求地址
            changeOrigin: true,
            pathRewrite: { // 请求中去除/api
                "^/app": "/app"
            },
            secure:false,
            onProxyReq: function onProxyReq(proxyReq, req, res) {
                // 我就打个log康康
                console.log('-->  ', req.method, req.baseUrl, '->', proxyReq.host + proxyReq.path);
            }
        })
    )
};
